package com.hpeng.basic.dao.impl;

import org.springframework.stereotype.Component;
import com.hpeng.basic.dao.OtherDataDao;
import com.hpeng.sys.model.AssetCard;
import com.hpeng.sys.model.Category;
import com.hpeng.sys.model.Staff;
import com.hpeng.sys.model.SysLogger;
import com.hpeng.util.GenericDaoImpl;
import com.hpeng.util.Pagination;
@Component("otherDataDao")
public class OtherDataDaoImpl  extends GenericDaoImpl<AssetCard, String> implements OtherDataDao {

	public void UpdateAssetCard(AssetCard assetCard) {
		super.saveOrUpdate(assetCard);
	}

	public void delAssetCard(String id) {
		AssetCard assetCard = super.findEnityById(AssetCard.class, id);
		super.delete(assetCard);
	}

	public Pagination<AssetCard> getAssetCard(int pageNumber, String[] hql,String order) {
		Pagination<AssetCard> pagination = null;
		StringBuffer sb = new StringBuffer();
		try {
			for (String str : hql) {
				sb.append(str);
			}
			pagination = this.getPagination(sb.toString() + order, null, pageNumber);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pagination;
	}

	public AssetCard getAssetCardById(String id) {
		return super.findEnityById(AssetCard.class, id);
	}
	public Pagination<AssetCard> getAssetCardByCatId(int pageNumber,String[] hql,String order) {
		Pagination<AssetCard> pagination = null;
		StringBuffer sb = new StringBuffer();
		try {
			for (String str : hql) {
				sb.append(str);
			}
			pagination = this.getPagination(sb.toString() + order, null, pageNumber);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pagination;
	}

	public void savaAc(AssetCard ac) {
		super.save(ac);
	}
}
